/**
 * @Author lilinjie
 * @Description: 用户API
 */
import http from '@/utils/request'

// 获得用户
export const getAllUsers = ({ current: pageNum, pageSize }) => http({
  method: 'GET',
  url: `/admin/user/getUserList/${pageNum}/${pageSize}`
})

// 添加用户
export const addUser = (data) => http({
  method: 'POST',
  url: `/admin/user/addUser`,
  data
})

// 更新用户
export const updateUser = () => http({
  method: 'POST',
  url: `/admin/user/updateUserInfo`,
  data: {
    password: '123456'
  }
})

// 删除用户
export const deleteUser = (id) => http({
  method: 'GET',
  url: `/admin/user/deleteUser/${id}`
})

// 条件查询用户
export const searchOrder = ({ status, sex, username, current: pageNum, pageSize }) => http({
  method: 'POST',
  url: `/admin/user/getByUserListByQueryParam`,
  params: {
    pageNum,
    pageSize
  },
  data: {
    status,
    sex,
    username
  }
})
